<meta charset="utf-8">
<title>兼职股东管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta name="description" content="网站描述">
<meta name="keywords" content="">
<meta name="author" content="wangl">
<link rel="icon" href="http://ow9lg82yy.bkt.clouddn.com/24f5c360-485d-4a6d-9468-2a61c353cf37.ico">
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<link rel="stylesheet" href="//at.alicdn.com/t/font_tnyc012u2rlwstt9.css" media="all">
<link rel="stylesheet" href="/static/css/user.css" media="all">
<link rel="stylesheet" href="/static/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">

</head>
<body class="childrenBody">
<#--<div class="layui-col-xs2">-->
    <#--<div class="grid-demo grid-demo-bg1">-->
        <#--<ul id="treeDemo" class="ztree"></ul>-->
    <#--</div>-->
<#--</div>-->
<div">
    <#--可通过姓名、手机号、身份证号进行股东搜索-->
    <fieldset class="layui-elem-field">
        <legend></legend>
        <div class="layui-field-box">
            <form class="layui-form" id="searchForm" action="">
                <div class="layui-inline" style="margin-left: 15px">
                    <label>姓名:</label>
                    <div class="layui-input-inline">
                        <input type="text" value="" id="nickName" name="nickName" placeholder="请输入姓名"
                               class="layui-input search_input">
                    </div>
                </div>
                <div class="layui-inline" style="margin-left: 15px">
                    <label>手机号:</label>
                    <div class="layui-input-inline">
                        <input type="text" value="" id="tel" name="tel" placeholder="请输入手机号"
                               class="layui-input search_input">
                    </div>
                </div>
                <div class="layui-inline" style="margin-left: 15px">
                    <label>身份证号:</label>
                    <div class="layui-input-inline">
                        <input type="text" value="" id="idCardNum" name="idCardNum" placeholder="请输入身份证号"
                               class="layui-input search_input">
                    </div>
                </div>
                <div class="layui-inline" style="margin-left: 15px">
                    <label>注册时间:</label>
                    <div class="layui-inline">
                        <input type="text" class="layui-input" id="startTime" name="startTime"
                               lay-verify="date">
                    </div>
                    <span>-</span>
                    <div class="layui-inline">
                        <input type="text" class="layui-input" name="endTime" id="endTime"
                               lay-verify="date">
                    </div>
                </div>
                <div class="layui-inline">
                    <button type="button" class="layui-btn" onclick="getShareholder()">搜索</button>
                </div>
                <div class="layui-inline">
                    <#--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                </div>
                <br>
                <div class="layui-inline">
                    <button type="button" class="layui-btn" id="upload">批量添加股东</button>
                    <input type="file" name="fileName" id="file1">
                </div>
                <div class="layui-inline">
                    <a href="addpage" class="layui-btn layui-btn-normal" data-type="addBlogArticle">新增兼职股东</a>
                </div>
            </form>
        </div>
    </fieldset>
    <div class="layui-form users_list">

                        <table cellspacing="0" cellpadding="0" border="0" class="layui-table">
                            <thead>
                            <tr>
                                <#--平台输入股东姓名、手机号、开户银行、开户支行、银行卡号、登录密码-->
                                <th data-field="id">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>编号</span></div>
                                </th>
                                <th data-field="nickName">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>股东姓名</span></div>
                                </th>
                                <th data-field="tel">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>手机号</span></div>
                                </th>
                                <th data-field="cardTypeName">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>证件类型</span></div>
                                </th>
                                <th data-field="idCardNum">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>证件号码</span></div>
                                </th>
                                <th data-field="openBank">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>开户银行</span></div>
                                </th>
                                <th data-field="openBankBranch">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>开户支行</span></div>
                                </th>
                                <th data-field="bankCardNum">
                                    <div class="layui-table-cell laytable-cell-1-anid1"><span>银行卡号</span></div>
                                </th>
                                <th data-field="createDate" data-unresize="true">
                                    <div class="layui-table-cell laytable-cell-1-publistTime"><span>注册时间</span></div>
                                </th>
                                <th data-field="9">
                                <div class="layui-table-cell laytable-cell-1-9" align="center"><span>操作</span></div>
                                </th>
                            </tr>
                            </thead>
                            <tbody id="anList">
                            </tbody>
                        </table>
                        <div class="box-tools pull-right">
                            <ul class="pagination" id="pagination_ul">
                            </ul>
                        </div>

    </div>
</div>
</body>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/tools.js"></script>
<script type="text/javascript" src="/static/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/static/js/CodeConstbonusList.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script>

    function loadData(baseDto) {
        if (baseDto.code == ERROR)
            console.log(baseDto.msg);
        else {
            //数据
            var data = baseDto.data;
            var text = "";
            var opreate = "";
            $.each(data, function (index, bonus) {
                console.log(bonus);
                if (bonus.bonus==0) {
                    if (bonus.userState==0) {
                        // opreate = "<td>" + "<a href='/back/finance/dividends/update?bonusId=" + bonus.id + "&userId="+"" + bonus.shareholderId + "' type=\"button\" class=\"layui-btn layui-btn-xs\">补充分红</a>\n" + "</td>\n"
                    }
                } else {
                    // opreate = "<td>" + "<a href='/back/shareholder/freeze?type=" + 1 + "&userId=" + bonus.id + "' type=\"button\" class=\"layui-btn layui-btn-xs\">冻结</a>\n" + "</td>\n"
                    opreate ="<td class=\"text-center\" align=\"center\">\n" +
                        "    <a href='/back/shareholder/freeze?type=" + 1 + "&userId=" + bonus.id + "'   type=\"button\" class=\"layui-btn layui-btn-xs\">冻结</a>\n" +
                        "    <a href='/back/shareholder/freeze?type=" + 2 + "&userId=" + bonus.id + "'  type=\"button\" class=\"layui-btn layui-btn-xs\">解冻</a>\n" +
                        "    <a href='/back/shareholder/editpage?userId=" + bonus.id + "'  type=\"button\" class=\"layui-btn layui-btn-xs\">编辑</a>\n" +
                        "    <a href='/back/shareholder/shareholderformlistpage?userId=" + bonus.id + "'   type=\"button\" class=\"layui-btn layui-btn-xs\">股东报单</a>\n" +
                        // "    <a href='/back/admin/admin/userCapitalPage?userType=1&userId=" + shareholderList.user.id + "'  type=\"button\" class=\"layui-btn layui-btn-xs\">资产详情</a>\n" +
                        "</td>\n"
                }
                text += "<tr>\n" +
                    "<td>" + bonus.id + "</td>\n" +
                    "<td>" + bonus.nickName + "</td>\n" +
                    "<td>" + bonus.tel + "</td>\n" +
                    "<td>" + bonus.cardTypeName + "</td>\n" +
                    "<td>" + bonus.idCardNum + "</td>\n" +
                    "<td>" + bonus.openBank + "</td>\n" +
                    "<td>" + bonus.openBankBranch + "</td>\n" +
                    "<td>" + bonus.bankCardNum + "</td>\n" +
                    "<td>" + bonus.createDate + "</td>\n" +
                     opreate
                    "</tr>";
            });

            var bonusListDom = $("#anList");
            bonusListDom.empty();//清空子元素
            bonusListDom.append($(text));
//            var pages = baseDto.data.pages;
//            var pageNum = baseDto.data.pageNum;
//            var btnList = "";
//            btnList += "<li class='first_page'><a onclick='loadPage(this)' link='/back/shareholder/list'>" + "首页" + "</a></li>";
//            var temp = "<li class='prepage'><a onclick='loadPage(this)' link='/back/shareholder/list?pageNum=" + (pageNum - 1) + "'>上一页</a></li>";
//            console.log("temp=" + temp);
//            btnList += temp;
//            for (var i = 0; i < pages; i++) {
//                btnList += ("<li class='prepage'><a onclick='loadPage(this)' link='/back/shareholder/list?pageNum=" + (i + 1) + "'>" + (i + 1) + "</a></li>\n")
//            }
//            btnList += ("<li class='nextpage'><a onclick='loadPage(this)' link='/back/shareholder/list?pageNum=" + (pageNum + 1) + "'>下一页</a></li>\n" +
//                "<li class='last_page' ><a onclick='loadPage(this)' link='/back/shareholder/list?pageNum=" + pages + "'>末页</a></li>");
//            console.log(btnList);
//            var pagination_ul = $("#pagination_ul");
//            pagination_ul.empty();
//            pagination_ul.append(btnList);
            layui.use("laypage",function () {
                laypage = layui.laypage;
                var newData = baseDto.data;
                laypage.render({
                    elem: 'pagination_ul'
                    ,count: newData.length
                    ,curr: newData.fristPage //获取起始页
                    ,limit: 10
                    ,jump: function (obj) {
                        loadPage(obj.curr);
                    }

                });
            });
        }
    }

    function loadPage(a) {
        var a_jquery = $(a);
        var url = a_jquery.attr("link");
        $.ajax(
            {
                url: url,
                type: "GET",
                success: function (baseDto) {
                    loadData(baseDto);
                }
            }
        );
    }

    //获取数据
    $.ajax({
        url: "/back/shareholder/list",
        type: "GET",
        success: function (baseDto) {
            loadData(baseDto);
        }
    });

    function getShareholder() {
        var nickName = $("#nickName").val();
        var tel = $("#tel").val();
        var idCardNum = $("#idCardNum").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();

        $.ajax({
            url: "/back/shareholder/list",
            type: "GET",
            data:{
                nickName:nickName,
                tel:tel,
                idCardNum:idCardNum,
                startTime:startTime,
                endTime:endTime
            },
            success: function (baseDto) {
                loadData(baseDto);
            }
        });
        return baseDto;
    };

    layui.use(['form', 'laydate'], function () {
        var form = layui.form;
        var laydate = layui.laydate;
        // form.render('select', 'memberState');
        laydate.render({
            elem: '#endTime',
            type: 'string'
        });

        laydate.render({
            elem: '#startTime',
            type: 'string'
        });

    });

    $("#upload").click(function () {

        $.ajax({
            url: "/back/parttime/shareholder/uploadExcel",
            type: "POST",
            data: new FormData(document.getElementById('searchForm')),
            /**
             *必须false才会自动加上正确的Content-Type
             */
            contentType: false,
            /**
             * 必须false才会避开jQuery对 formdata 的默认处理
             * XMLHttpRequest会对 formdata 进行正确的处理
             */
            processData: false,
            success: function (data) {
                printJson(data);
                if (data.status == "true") {
                    alert("上传成功！");
                }
                if (data.status == "error") {
                    alert(data.msg);
                }
            },
            error: function () {
                alert("上传失败！");
                $("#imgWait").hide();
            }
        });
    });

</script>


</html>